package cn.zt.controller;

import cn.zt.common.Result;
import cn.zt.domain.CreditCard;
import cn.zt.service.CreditCardService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.swing.plaf.PanelUI;

@RestController
@RequestMapping("CreditCard")
public class CreditCardController {

    @Resource
    private CreditCardService creditCardService;

    //办理信用卡
    @PostMapping("addCreditCard")
    public Result addCreditCard(@RequestBody CreditCard creditCard){
        return creditCardService.addCreditCard(creditCard);
    }

    //通过userid查询信用卡信息
    @GetMapping("selectByUid")
    public Result selectByUid(@RequestParam("id") Integer id){
        return creditCardService.selectByUid(id);
    }

    //转出借款
    @PostMapping("rollMoney")
    public Result rollMoney(@RequestBody CreditCard creditCard){
        return creditCardService.rollMoney(creditCard);
    }

    //计算当前用户的超额费用的利息和月还款金额
    @GetMapping("countover")
    public Result countover(@RequestParam("id") Integer id){
        return creditCardService.countover(id);
    }


    //还款
    @PostMapping("dueMoney")
    public Result dueMoney(@RequestBody CreditCard creditCard){
        return creditCardService.dueMoney(creditCard);
    }

    //判断还款日期
    @GetMapping("dueDate")
    public Result dueDate(@RequestParam("id") int id){
        return creditCardService.dueDate(id);
    }

    //判断是否逾期
    @GetMapping("yuqi")
    public Result yuqi(@RequestParam("id") int id){
        return creditCardService.yuqi(id);
    }


}
